package com.yh.patterns.singleton.demo9;

import java.io.InputStream;

/**
 * @Auther:云尚学Java
 */
public class RuntimeDemo {
    public static void main(String[] args) throws Exception {
        //获取Runtime类的对象
        Runtime runtime = Runtime.getRuntime();
        //调用Runtime的方法exec,其参数要的是一个命令
        Process process = runtime.exec("ipconfig");
        //调用process对象的获取输入流的方法
        InputStream inputStream = process.getInputStream();
        byte[] arr=new byte[1024 * 1024 * 100];
        //读取数据
        int read = inputStream.read(arr);   //返回读到的字节的个数
        //将字节数组转换为字符串输出到控制台
        System.out.println(new String(arr,0,read,"GBK"));
    }
}
